package com.bzy.bookservice.controller;

import com.bzy.Book;
import com.bzy.BookInfo;
import com.bzy.DataPage;
import com.bzy.bookservice.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Author     : Bzy.
 * @ Date       : 2020/12/28 -- 19:56
 * @ Version:     $ 1.0
 */
@RestController
public class BookController {

    @Autowired
    private BookService bookService;

    @GetMapping("/books")
    public DataPage<Book> getAllBook(Integer pageNum, Integer pageSize) {//1 3
        return bookService.getAllBook(pageNum, pageSize);
    }

    @GetMapping("/bookInfo")
    public List<BookInfo> getAllBookInfo() {
        return bookService.getAllBookInfo();
    }
}
